
import mixin from '@/mixin/mixin.js'
const app= getApp()
export default {
  mixins: [mixin],
  props: {
    height: {
      type: String,
      default: "30%"
    },
    //不传： 呈现圆角效果，  传即没有圆角，我也不知道uni-popup的封装原理
    bgColor: {
      type: String,
      default: ""
    },
    footerHeight: {
      type: Number,
      default: 88
    },
    showOrHideTabbar: {
      type: Boolean,
      default: false
    },
    popupType: {
      type: String,
      default: 'bottom'
    },
    // 点击遮罩层 关闭
    maskClick: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      show: false,
    }
  },
  watch: {
  },
  computed: {
    //单位是rpx 所以*2
    safeAreaBottom() {
      const { bottom } =  app.globalData.systemInfo.safeAreaInsets
      return bottom
    }
  },
  mounted(){
  },
  methods: {
    /**
     * 打开或者关闭弹窗
     * @param {是否开启} isShow 
     */
    togglePopup(isShow) {
      if (isShow) {
        this.$refs.popup.open();
      }else {
        this.$refs.popup.close();
      }
    },
    //弹窗关闭时 显示tabbar
    handelChange(e) {
      const { show } = e
      if (!show && this.showOrHideTabbar) {
        console.log('===========================');
        this.showTabbar()
      }
      this.show = show;
      this.$emit('onChange', e)
    },
  }
}